package com.li.bean2;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class User {
    private String name;
    private int age;

//    @Value("张三")
//    public void setName(String name) {
//        this.name = name;
//    }
//
//    @Value("30")
//    public void setAge(int age) {
//        this.age = age;
//    }


    public User(@Value("李四") String name, @Value("31") int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "User{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
